<p>
  Like most programming languages, Python has comparison operators:
</p>
<div class="section-example-container">

<pre class="python">print 1 == 0    # 1 equals 0
print 1 == 1    # 1 equals 1
print 1 != 0    # 1 is not equal to 0
print 5 &gt;= 5    # 5 is greater than or equal to 5
print 5 &gt;= 6    # 5 is greater than or equal to 6
[out]:
False
True
True
True
False
</pre>
</div>

<p>
  Each statement above has a boolean value, which must be either True or False, but not both.
</p>
<p>
  We can combine simple statements P and Q to form complex statements using logical operators:
</p>
<ul>
    <li>The statement "P and Q" is true if both P and Q are true, otherwise it is false.</li>
    <li>The statement "P or Q" is false if both P and Q are false, otherwise it is true.</li>
    <li>The statement "not P" is true if P is false, and vice versa.</li>
</ul>

<div class="section-example-container">

<pre class="python">print 2 &gt; 1 and 3 &gt; 2
print 2 &gt; 1 and 3 &lt; 2
print 2 &gt; 1 or  3 &lt; 2
print 2 &lt; 1 and 3 &lt; 2
[out]:
True
False
True
False
</pre>
</div>

<p>
  When dealing with a very complex logical statement that involves in several statements, we can use brackets to separate and combine them.
</p>

<div class="section-example-container">

<pre class="python">print (3 &gt; 2 or 1 &lt; 3) and (1!=3 and 4&gt;3) and not ( 3 &lt; 2 or 1 &lt; 3 and (1!=3 and 4&gt;3))
print 3 &gt; 2 or 1 &lt; 3 and (1!=3 and 4&gt;3) and not ( 3 &lt; 2 or 1 &lt; 3 and (1!=3 and 4&gt;3))
[out]:
False
True
</pre>
</div>

<p>
  Comparing the above two statements, we can see that it's wise to use brackets when we make a complex logical statement.
</p>
